home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / gedit-2 / plugins / snippets / lang / snippets.lang
Encoding:
Extensible Markup Language  |  2009-04-14  |  7.2 KB  |  163 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.  
  4.  Author: Jesse van den Kieboom <jesse@icecrew.nl>
  5.  Copyright (C) 2007-2008 Jesse van den Kieboom <jesse@icecrew.nl>
  6.  
  7.  This library is free software; you can redistribute it and/or
  8.  modify it under the terms of the GNU Library General Public
  9.  License as published by the Free Software Foundation; either
  10.  version 2 of the License, or (at your option) any later version.
  11.  
  12.  This library is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  Library General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU Library General Public
  18.  License along with this library; if not, write to the
  19.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  Boston, MA 02111-1307, USA.
  21.  
  22. -->
  23. <language id="snippets" _name="Snippets" hidden="true" version="2.0">
  24.   <styles>
  25.     <style id="placeholder-bounds" _name="Placeholder begin and end" map-to="def:function"/>
  26.     <style id="default-value"      _name="Default Value" map-to="def:string"/>
  27.     <style id="single-placeholder" _name="Single Placeholder" map-to="def:decimal"/>
  28.     <style id="shell-placeholder"  _name="Shell Placeholder" map-to="def:preprocessor"/>
  29.     <style id="python-placeholder" _name="Python Placeholder" map-to="def:preprocessor"/>
  30.     <style id="regex-placeholder"  _name="Regular Expression Placeholder" map-to="def:preprocessor"/>
  31.     <style id="tabstop"            _name="Tabstop"  map-to="def:decimal"/>
  32.     <style id="placeholder-ref"    _name="Placeholder Reference" map-to="def:decimal"/>
  33.     <style id="placeholder-def"    _name="Placeholder Default" map-to="def:string"/>
  34.     <style id="escape"             _name="Escape" map-to="def:special-char"/>
  35.     <style id="environmental-var"  _name="Environmental Variable" map-to="def:string"/>
  36.     <style id="seperator"          _name="Seperator" map-to="def:shebang"/>
  37.     <style id="regex-pattern"      _name="Regular Expression Pattern" map-to="def:string"/>
  38.     <style id="replace-pattern"    _name="Regular Expression Replace Pattern" map-to="def:string"/>
  39.     <style id="modifier"           _name="Modifier" map-to="def:keyword"/>
  40.   </styles>
  41.  
  42.   <definitions>
  43.     <define-regex id="number">[0-9]+</define-regex>
  44.     <define-regex id="tabstop">\s*((\%{number})(:))</define-regex>
  45.     <define-regex id="number-list" extended="true">\s*(\[(\%{number}(,\%{number})*)\](:))</define-regex>
  46.     <define-regex id="environment">\$[A-Z_]+</define-regex>
  47.     <define-regex id="regex-pattern">((?:\\[/]|\\}|[^/}])+)</define-regex>
  48.   
  49.     <context id="escape" style-ref="escape">
  50.       <match>\\\$</match>
  51.     </context>
  52.     <context id="single-placeholder" style-ref="single-placeholder">
  53.       <match>\$\%{number}|\${\%{number}}</match>
  54.     </context>
  55.     <context id="simple-placeholder-def" style-ref="default-value">
  56.       <start>\${\%{tabstop}</start>
  57.       <end>}</end>
  58.       <include>
  59.         <context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
  60.         <context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
  61.         <context sub-pattern="2" where="start" style-ref="tabstop"/>
  62.         <context sub-pattern="3" where="start" style-ref="seperator"/>
  63.         <context>
  64.           <match>\\}</match>
  65.         </context>
  66.         <context ref="escape"/>
  67.         <context ref="environmental-variable"/>
  68.       </include>
  69.     </context>
  70.     <context id="simple-placeholder">
  71.       <include>
  72.         <context ref="single-placeholder"/>
  73.         <context ref="simple-placeholder-def"/>
  74.       </include>
  75.     </context>
  76.     <context id="shell-placeholder-contents">
  77.       <include>
  78.         <context ref="escape"/>
  79.         <context ref="environmental-variable"/>
  80.         <context ref="single-placeholder"/>
  81.       </include>
  82.     </context>
  83.     <context id="shell-placeholder">
  84.       <include>
  85.         <context style-ref="shell-placeholder">
  86.           <start>\$\(\%{tabstop}?</start>
  87.           <end>\)</end>
  88.           <include>
  89.             <context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
  90.             <context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
  91.             <context sub-pattern="2" where="start" style-ref="tabstop"/>
  92.             <context sub-pattern="3" where="start" style-ref="seperator"/>
  93.             <context ref="shell-placeholder-contents"/>
  94.             <context>
  95.               <match>\\\)</match>
  96.             </context>
  97.           </include>
  98.         </context>
  99.         <context style-ref="shell-placeholder">
  100.           <start>`\%{tabstop}?</start>
  101.           <end>`</end>
  102.             <include>
  103.               <context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
  104.               <context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
  105.               <context sub-pattern="2" where="start" style-ref="tabstop"/>
  106.               <context sub-pattern="3" where="start" style-ref="seperator"/>
  107.               <context ref="shell-placeholder-contents"/>
  108.               <context>
  109.                 <match>\\`</match>
  110.               </context>
  111.             </include>
  112.         </context>      
  113.       </include>
  114.     </context>
  115.     <context id="python-placeholder">
  116.       <start>\$<\%{tabstop}?\%{number-list}?</start>
  117.       <end>></end>
  118.       <include>
  119.         <context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
  120.         <context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
  121.         <context sub-pattern="2" where="start" style-ref="tabstop"/>
  122.         <context sub-pattern="3" where="start" style-ref="seperator"/>
  123.         <context sub-pattern="5" where="start" style-ref="tabstop"/>
  124.         <context sub-pattern="7" where="start" style-ref="seperator"/>
  125.         <context>
  126.           <match>\\></match>
  127.         </context>
  128.         <context ref="escape"/>
  129.         <context ref="environmental-variable"/>
  130.         <context ref="single-placeholder"/>
  131.         <context ref="python:python"/>
  132.       </include>    
  133.     </context>
  134.     <context id="regex-placeholder" style-ref="regex-placeholder">
  135.       <match>(\${)\%{tabstop}?(?:\s*(?:(\%{number})|(\%{environment})))/\%{regex-pattern}/\%{regex-pattern}(?:[/]([a-zA-Z]*))?(})</match>
  136.       <include>
  137.         <context sub-pattern="1" style-ref="placeholder-bounds"/>
  138.         <context sub-pattern="10" style-ref="placeholder-bounds"/>
  139.         <context sub-pattern="3" style-ref="tabstop"/>
  140.         <context sub-pattern="4" style-ref="seperator"/>
  141.         <context sub-pattern="5" style-ref="tabstop"/>
  142.         <context sub-pattern="6" style-ref="environmental-var"/>
  143.         <context sub-pattern="7" style-ref="regex-pattern"/>
  144.         <context sub-pattern="8" style-ref="replace-pattern"/>
  145.         <context sub-pattern="9" style-ref="modifier"/>
  146.       </include>
  147.     </context>
  148.     <context id="environmental-variable" style-ref="environmental-var">
  149.       <match>\%{environment}</match>
  150.     </context>
  151.       <context id="snippets">
  152.         <include>
  153.           <context ref="escape"/>
  154.           <context ref="regex-placeholder"/>
  155.           <context ref="simple-placeholder"/>
  156.           <context ref="shell-placeholder"/>
  157.           <context ref="python-placeholder"/>
  158.           <context ref="environmental-variable"/>
  159.         </include>
  160.     </context>
  161.   </definitions>
  162. </language>
  163.